<? 



$deltager = $this->session->userdata('deltager');
$ingame = $this->session->userdata('ingame');


		//uri
		$id_beskrivelse = $this->uri->segment(7,0);


		//modeller
		$this->load->model('indhold/element_beskrivelse');
		
		$bsk = new element_beskrivelse();
		$bsk->find_element_beskrivelse($id_beskrivelse);
		$beskrivelse = $bsk->element_beskrivelse;
		//print_r($beskrivelse);

?>
<form action="<?php echo base_url();?>indhold/rediger" method="post">
<input type="hidden" name="id_element" value="<? echo $stamdata['id']; ?>">
<input type="hidden" name="id_beskrivelse" value="<? echo $id_beskrivelse; ?>">
<input type="hidden" name="type" value="<? echo $type; ?>">
<?

?>
<!-- FEATURE ----------------------------------------------------------------------------------><?

	$feature_array = $this->beskrivelse->feature($beskrivelse['feature']);
	$feature_array['feature_tekst'] = str_replace("&element;", $navne[0], $feature_array['feature_tekst']);
	
	if($type == "individ")
	{
		$pps = $this->ord_model->pps($stamdata['id']);
		$feature_array['feature_tekst'] = str_replace("&pps;", $pps, $feature_array['feature_tekst']);
	}


	?><input type="hidden" name="feature" value="<? echo $beskrivelse['feature'];?>" ><?

	$classes = $this->struktur_model->find_classes($stamdata['id']);
	$features = $this->beskrivelse->features($classes);
	?>
	<p id="vaelg_feature" <? if(!empty($beskrivelse['feature'])){ echo 'style="float:right;"';} ?>>
<b><span class="rubrik">Detaljens type: </span></b>
<select name='feature'><?

	
	foreach($features as $r)
	{
		
		?><option value="<? echo $r['feature']; ?>" <? if($beskrivelse['feature']== $r['feature']){ echo 'selected="selected"';} ?>><? echo $r['feature_navn']; ?></option><?
	}
?></select></p><?

?><!--h1 onclick="showstuff('vaelg_feature')" class='rubrik'><? echo $feature_array['feature_navn']; ?></h1--><?

// echo "<p class='rubrik'>".$feature_array['feature_tekst']."</p>";
	//echo $beskrivelse['feature'];


	//echo "classes er "; print_r($classes);

//echo br(1);

?>
<p class='rubrik' style="float:right;background:green;">
<?
if(!empty($ingame) and $ingame['ingame_id'] != 0)
{
	?>	
	<input type="hidden" name="forfatter" value="<? echo $ingame['ingame_id'];?> ">


	<span onclick="showstuff('vaelg_type_game')">

<!-- SKRIVER ---------------------------------------------------------------------------------->

	<b>Skriver</b></span>:
	<input type="radio" name="type_game" value="in_game" <? if($beskrivelse['type_game']== "in_game"){ echo 'checked="checked"';} ?> onclick="hidestuff('fravaelg_tid')" ><? echo $ingame['ingame_navn']; ?>
	<br>
	<span id="vaelg_type_game" <? if($beskrivelse['type_game']== "in_game"){ echo 'style="display:none"';} ?>>
		<? echo nbs(14); ?>
		<input onclick="showstuff('fravaelg_tid')" type="radio" name="type_game" <? if($beskrivelse['type_game']== "off_game"){ echo 'checked="checked"';} ?> value="off_game"><?echo $deltager['fornavn']."";?><br>
	</span>
	</p>

	<?

}
elseif($ingame['ingame_id'] == 0){ //hvis man er gamemaster
	echo "<p class='rubrik'><b>Skriver</b>: Gamemaster ".$deltager['fornavn']."</p>";
	?><input type="hidden" name="type_game" value="off_game"><?
}else{
	echo "<p class='rubrik'><b>Skriver</b>: ".$deltager['fornavn']."</p>";
	?><input type="hidden" name="type_game" value="off_game"><?

}
echo "</p>";
?>
<br>

<br>
<p class="rubrik"><b>Resume:</b></p><input name="overskrift" type="text" style="width:98%;height:20px;" value="<? echo $beskrivelse['overskrift']; ?>">
<br><br>
<p class="rubrik"><b>Uddybning:</b></p>
<div class="ink"><textarea id="editable" name="tekst" cols="50" style="width:98%;height:200px;"><? echo $beskrivelse['tekst']; ?></textarea></div>
<br><br>


<?
if(isset($beskrivelse['ingame_tid_dato'])){
	$data['datoarray'] = $beskrivelse['ingame_tid_dato'];
}else{
	$data['datoarray'] = $ingame_nu['tid_dato'];
}
?>
<div style="float:right;overflow:auto;">
<h2 class="rubrik" style="text-align:right;">Ingame tid</h2>

<?
$this->load->view('core/tid', $data);
 if($beskrivelse['ingame_tid_db'] == 0 or empty($beskrivelse['ingame_tid_db'])){ 
	$checkaf_fravaelg_tid = "ja"; 
}else{
	$checkaf_fravaelg_tid = "nej"; 
} ?>

<p style="float:right;" id="fravaelg_tid" class="rubrik"  <?if($beskrivelse['type_game']=="in_game"){ echo 'style="display:none"'; }?>> <input type="checkbox" name="fravaelg_tid" value="ja" <?if($checkaf_fravaelg_tid == "ja"){ echo "checked='checked'"; }?>> Fravælg tid </p>
</div>

<h2 class="rubrik">Synlighed</h2>
<p class="rubrik"><input type="radio" name="hemmelig" value="3" <? if($beskrivelse['hemmelig']== 3){ echo 'checked="checked"';} ?>>Hemmelig</input><br><input type="radio" name="hemmelig" value="1" <? if($beskrivelse['hemmelig']== 1){ echo 'checked="checked"';} ?>>Offentlig</input></p><br>
<br>
<input type="submit" value="Ret Detalje" class="rubrik" style="float:right;">
</form>

<? //echo $this->load->view('admin/wysiwyg', base_url(), true); ?>


              <script type="text/javascript">
                     Aloha.ready( function() {
                            var $ = Aloha.jQuery;
                            $('#editable').aloha();
                     });




              </script>



